﻿using System; 
using System.Text;
using System.Collections.Generic; 
using System.Data;
using System.Data.SqlClient;
using ART.Data;
using ART.Common;
using ART.Model;
using ART.Cache;

namespace ART.BLL {
  //UsersDetail
 	public partial class B_UsersDetail
	{
   		
		public B_UsersDetail()
		{}
        #region __________基础方法__________
		/// <summary>
		/// 删除指定缓存
		/// </summary>
		public void ClearCache(string key)
		{
		    string CacheKey = "BLL/UsersDetail";
			if(!string.IsNullOrEmpty(key)){
			    CacheKey+="/"+key;
			}
			LRSCache.GetCacheService().RemoveObject(CacheKey);
		}
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public void  Add(ART.Model.M_UsersDetail model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into UsersDetail(");			
            strSql.Append("UId,Name,Sex,Age,Img,BirthDate,Phone,Mobile,Address,IDType,IDNumber,IDAddress,Email,QQ,EntryDate,LeaveDate,Remarks,AreaId,Professional,State,Nation,Birthplace,Marriage,Height,Education,LangScore,Language,Computer,WorkYear,ManagerYear,HavAbroad,HavCarSale,CarBrand,CarYear,HavCarManager,Relations,Skills,CardNumber,Notes,Achievement,RefreshTime");
			strSql.Append(") values (");
            strSql.Append("@UId,@Name,@Sex,@Age,@Img,@BirthDate,@Phone,@Mobile,@Address,@IDType,@IDNumber,@IDAddress,@Email,@QQ,@EntryDate,@LeaveDate,@Remarks,@AreaId,@Professional,@State,@Nation,@Birthplace,@Marriage,@Height,@Education,@LangScore,@Language,@Computer,@WorkYear,@ManagerYear,@HavAbroad,@HavCarSale,@CarBrand,@CarYear,@HavCarManager,@Relations,@Skills,@CardNumber,@Notes,@Achievement,@RefreshTime");            
            strSql.Append(") ");            
            	
			#region __________参数__________	
			SqlParameter[] parameters = {
			            new SqlParameter("@UId", SqlDbType.Int,4) ,            
                        new SqlParameter("@Name", SqlDbType.VarChar,30) ,            
                        new SqlParameter("@Sex", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Age", SqlDbType.Int,4) ,            
                        new SqlParameter("@Img", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@BirthDate", SqlDbType.DateTime) ,            
                        new SqlParameter("@Phone", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Mobile", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Address", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@IDType", SqlDbType.Int,4) ,            
                        new SqlParameter("@IDNumber", SqlDbType.VarChar,150) ,            
                        new SqlParameter("@IDAddress", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@Email", SqlDbType.VarChar,50) ,            
                        new SqlParameter("@QQ", SqlDbType.VarChar,50) ,            
                        new SqlParameter("@EntryDate", SqlDbType.DateTime) ,            
                        new SqlParameter("@LeaveDate", SqlDbType.DateTime) ,            
                        new SqlParameter("@Remarks", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@AreaId", SqlDbType.Int,4) ,            
                        new SqlParameter("@Professional", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@State", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Nation", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Birthplace", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Marriage", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Height", SqlDbType.Real,4) ,            
                        new SqlParameter("@Education", SqlDbType.Int,4) ,            
                        new SqlParameter("@LangScore", SqlDbType.Int,4) ,            
                        new SqlParameter("@Language", SqlDbType.Int,4) ,            
                        new SqlParameter("@Computer", SqlDbType.Int,4) ,            
                        new SqlParameter("@WorkYear", SqlDbType.Int,4) ,            
                        new SqlParameter("@ManagerYear", SqlDbType.Int,4) ,            
                        new SqlParameter("@HavAbroad", SqlDbType.Bit,1) ,            
                        new SqlParameter("@HavCarSale", SqlDbType.Bit,1) ,            
                        new SqlParameter("@CarBrand", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@CarYear", SqlDbType.Int,4) ,            
                        new SqlParameter("@HavCarManager", SqlDbType.Bit,1) ,            
                        new SqlParameter("@Relations", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@Skills", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@CardNumber", SqlDbType.VarChar,50) ,            
                        new SqlParameter("@Notes", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@Achievement", SqlDbType.Text) ,            
                        new SqlParameter("@RefreshTime", SqlDbType.DateTime)             
              
            };
			
			            
            parameters[0].Value = model.UId;                        
            parameters[1].Value = model.Name;                        
            parameters[2].Value = model.Sex;                        
            parameters[3].Value = model.Age;                        
            parameters[4].Value = model.Img;                        
            parameters[5].Value = model.BirthDate;                        
            parameters[6].Value = model.Phone;                        
            parameters[7].Value = model.Mobile;                        
            parameters[8].Value = model.Address;                        
            parameters[9].Value = model.IDType;                        
            parameters[10].Value = model.IDNumber;                        
            parameters[11].Value = model.IDAddress;                        
            parameters[12].Value = model.Email;                        
            parameters[13].Value = model.QQ;                        
            parameters[14].Value = model.EntryDate;                        
            parameters[15].Value = model.LeaveDate;                        
            parameters[16].Value = model.Remarks;                        
            parameters[17].Value = model.AreaId;                        
            parameters[18].Value = model.Professional;                        
            parameters[19].Value = model.State;                        
            parameters[20].Value = model.Nation;                        
            parameters[21].Value = model.Birthplace;                        
            parameters[22].Value = model.Marriage;                        
            parameters[23].Value = model.Height;                        
            parameters[24].Value = model.Education;                        
            parameters[25].Value = model.LangScore;                        
            parameters[26].Value = model.Language;                        
            parameters[27].Value = model.Computer;                        
            parameters[28].Value = model.WorkYear;                        
            parameters[29].Value = model.ManagerYear;                        
            parameters[30].Value = model.HavAbroad;                        
            parameters[31].Value = model.HavCarSale;                        
            parameters[32].Value = model.CarBrand;                        
            parameters[33].Value = model.CarYear;                        
            parameters[34].Value = model.HavCarManager;                        
            parameters[35].Value = model.Relations;                        
            parameters[36].Value = model.Skills;                        
            parameters[37].Value = model.CardNumber;                        
            parameters[38].Value = model.Notes;                        
            parameters[39].Value = model.Achievement;                        
            parameters[40].Value = model.RefreshTime;            			
            #endregion
			            SqlHelper.ExecNonQuery(strSql.ToString(),parameters);
            		
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ART.Model.M_UsersDetail model)
		{
		    StringBuilder strSql=new StringBuilder();
			#region __________语句__________
			strSql.Append("update UsersDetail set ");
			                        
            strSql.Append(" UId = @UId , ");                                    
            strSql.Append(" Name = @Name , ");                                    
            strSql.Append(" Sex = @Sex , ");                                    
            strSql.Append(" Age = @Age , ");                                    
            strSql.Append(" Img = @Img , ");                                    
            strSql.Append(" BirthDate = @BirthDate , ");                                    
            strSql.Append(" Phone = @Phone , ");                                    
            strSql.Append(" Mobile = @Mobile , ");                                    
            strSql.Append(" Address = @Address , ");                                    
            strSql.Append(" IDType = @IDType , ");                                    
            strSql.Append(" IDNumber = @IDNumber , ");                                    
            strSql.Append(" IDAddress = @IDAddress , ");                                    
            strSql.Append(" Email = @Email , ");                                    
            strSql.Append(" QQ = @QQ , ");                                    
            strSql.Append(" EntryDate = @EntryDate , ");                                    
            strSql.Append(" LeaveDate = @LeaveDate , ");                                    
            strSql.Append(" Remarks = @Remarks , ");                                    
            strSql.Append(" AreaId = @AreaId , ");                                    
            strSql.Append(" Professional = @Professional , ");                                    
            strSql.Append(" State = @State , ");                                    
            strSql.Append(" Nation = @Nation , ");                                    
            strSql.Append(" Birthplace = @Birthplace , ");                                    
            strSql.Append(" Marriage = @Marriage , ");                                    
            strSql.Append(" Height = @Height , ");                                    
            strSql.Append(" Education = @Education , ");                                    
            strSql.Append(" LangScore = @LangScore , ");                                    
            strSql.Append(" Language = @Language , ");                                    
            strSql.Append(" Computer = @Computer , ");                                    
            strSql.Append(" WorkYear = @WorkYear , ");                                    
            strSql.Append(" ManagerYear = @ManagerYear , ");                                    
            strSql.Append(" HavAbroad = @HavAbroad , ");                                    
            strSql.Append(" HavCarSale = @HavCarSale , ");                                    
            strSql.Append(" CarBrand = @CarBrand , ");                                    
            strSql.Append(" CarYear = @CarYear , ");                                    
            strSql.Append(" HavCarManager = @HavCarManager , ");                                    
            strSql.Append(" Relations = @Relations , ");                                    
            strSql.Append(" Skills = @Skills , ");                                    
            strSql.Append(" CardNumber = @CardNumber , ");                                    
            strSql.Append(" Notes = @Notes , ");                                    
            strSql.Append(" Achievement = @Achievement , ");                                    
            strSql.Append(" RefreshTime = @RefreshTime  ");            			
			strSql.Append(" where UId=@UId  ");
			
			#endregion	
			
			#region __________参数__________	
            SqlParameter[] parameters = {
			            new SqlParameter("@UId", SqlDbType.Int,4) ,            
                        new SqlParameter("@Name", SqlDbType.VarChar,30) ,            
                        new SqlParameter("@Sex", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Age", SqlDbType.Int,4) ,            
                        new SqlParameter("@Img", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@BirthDate", SqlDbType.DateTime) ,            
                        new SqlParameter("@Phone", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Mobile", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Address", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@IDType", SqlDbType.Int,4) ,            
                        new SqlParameter("@IDNumber", SqlDbType.VarChar,150) ,            
                        new SqlParameter("@IDAddress", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@Email", SqlDbType.VarChar,50) ,            
                        new SqlParameter("@QQ", SqlDbType.VarChar,50) ,            
                        new SqlParameter("@EntryDate", SqlDbType.DateTime) ,            
                        new SqlParameter("@LeaveDate", SqlDbType.DateTime) ,            
                        new SqlParameter("@Remarks", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@AreaId", SqlDbType.Int,4) ,            
                        new SqlParameter("@Professional", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@State", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Nation", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Birthplace", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Marriage", SqlDbType.VarChar,20) ,            
                        new SqlParameter("@Height", SqlDbType.Real,4) ,            
                        new SqlParameter("@Education", SqlDbType.Int,4) ,            
                        new SqlParameter("@LangScore", SqlDbType.Int,4) ,            
                        new SqlParameter("@Language", SqlDbType.Int,4) ,            
                        new SqlParameter("@Computer", SqlDbType.Int,4) ,            
                        new SqlParameter("@WorkYear", SqlDbType.Int,4) ,            
                        new SqlParameter("@ManagerYear", SqlDbType.Int,4) ,            
                        new SqlParameter("@HavAbroad", SqlDbType.Bit,1) ,            
                        new SqlParameter("@HavCarSale", SqlDbType.Bit,1) ,            
                        new SqlParameter("@CarBrand", SqlDbType.NVarChar,1000) ,            
                        new SqlParameter("@CarYear", SqlDbType.Int,4) ,            
                        new SqlParameter("@HavCarManager", SqlDbType.Bit,1) ,            
                        new SqlParameter("@Relations", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@Skills", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@CardNumber", SqlDbType.VarChar,50) ,            
                        new SqlParameter("@Notes", SqlDbType.VarChar,255) ,            
                        new SqlParameter("@Achievement", SqlDbType.Text) ,            
                        new SqlParameter("@RefreshTime", SqlDbType.DateTime)             
              
            };
            			            
            parameters[0].Value = model.UId;                        
            parameters[1].Value = model.Name;                        
            parameters[2].Value = model.Sex;                        
            parameters[3].Value = model.Age;                        
            parameters[4].Value = model.Img;                        
            parameters[5].Value = model.BirthDate;                        
            parameters[6].Value = model.Phone;                        
            parameters[7].Value = model.Mobile;                        
            parameters[8].Value = model.Address;                        
            parameters[9].Value = model.IDType;                        
            parameters[10].Value = model.IDNumber;                        
            parameters[11].Value = model.IDAddress;                        
            parameters[12].Value = model.Email;                        
            parameters[13].Value = model.QQ;                        
            parameters[14].Value = model.EntryDate;                        
            parameters[15].Value = model.LeaveDate;                        
            parameters[16].Value = model.Remarks;                        
            parameters[17].Value = model.AreaId;                        
            parameters[18].Value = model.Professional;                        
            parameters[19].Value = model.State;                        
            parameters[20].Value = model.Nation;                        
            parameters[21].Value = model.Birthplace;                        
            parameters[22].Value = model.Marriage;                        
            parameters[23].Value = model.Height;                        
            parameters[24].Value = model.Education;                        
            parameters[25].Value = model.LangScore;                        
            parameters[26].Value = model.Language;                        
            parameters[27].Value = model.Computer;                        
            parameters[28].Value = model.WorkYear;                        
            parameters[29].Value = model.ManagerYear;                        
            parameters[30].Value = model.HavAbroad;                        
            parameters[31].Value = model.HavCarSale;                        
            parameters[32].Value = model.CarBrand;                        
            parameters[33].Value = model.CarYear;                        
            parameters[34].Value = model.HavCarManager;                        
            parameters[35].Value = model.Relations;                        
            parameters[36].Value = model.Skills;                        
            parameters[37].Value = model.CardNumber;                        
            parameters[38].Value = model.Notes;                        
            parameters[39].Value = model.Achievement;                        
            parameters[40].Value = model.RefreshTime;            			
            #endregion
			
            int rows=SqlHelper.ExecNonQuery(strSql.ToString(),parameters);
			if (rows > 0)
			{
                string cachekey = "info_" + model.UId;
                ClearCache(cachekey);
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int UId)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from UsersDetail ");
			strSql.Append(" where UId=@UId ");
						SqlParameter[] parameters = {
					new SqlParameter("@UId", SqlDbType.Int,4)			};
			parameters[0].Value = UId;

			int rows=SqlHelper.ExecNonQuery(strSql.ToString(),parameters);
			
			//string cachekey="info_"+UId;
			//ClearCache(cachekey);
			
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

 	    /// <summary>
 	    /// 得到一个对象实体
 	    /// </summary>
 	    public ART.Model.M_UsersDetail GetModel(int UId)
 	    {
 	        string CacheKey = "BLL/UsersDetail/info_" + UId;
 	        object objModel = LRSCache.GetCacheService().RetrieveObject(CacheKey);
 	        if (objModel == null)
 	        {
 	            StringBuilder strSql = new StringBuilder();
 	            strSql.Append("select * from UsersDetail ");
 	            strSql.Append(" where UId=@UId ");

 	            SqlParameter[] parameters =
 	                {
 	                    new SqlParameter("@UId", SqlDbType.Int, 4)
 	                };
 	            parameters[0].Value = UId;


 	            ART.Model.M_UsersDetail model = new ART.Model.M_UsersDetail();
 	            DataSet ds = SqlHelper.ExecDataSet(strSql.ToString(), parameters);

 	            if (ds.Tables[0].Rows.Count > 0)
 	            {
 	                #region __________实体赋值__________

 	                if (ds.Tables[0].Rows[0]["UId"].ToString() != "")
 	                {
 	                    model.UId = int.Parse(ds.Tables[0].Rows[0]["UId"].ToString());
 	                }
 	                model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
 	                model.Sex = ds.Tables[0].Rows[0]["Sex"].ToString();
 	                if (ds.Tables[0].Rows[0]["Age"].ToString() != "")
 	                {
 	                    model.Age = int.Parse(ds.Tables[0].Rows[0]["Age"].ToString());
 	                }
 	                model.Img = ds.Tables[0].Rows[0]["Img"].ToString();
 	                if (ds.Tables[0].Rows[0]["BirthDate"].ToString() != "")
 	                {
 	                    model.BirthDate = DateTime.Parse(ds.Tables[0].Rows[0]["BirthDate"].ToString());
 	                }
 	                model.Phone = ds.Tables[0].Rows[0]["Phone"].ToString();
 	                model.Mobile = ds.Tables[0].Rows[0]["Mobile"].ToString();
 	                model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
 	                if (ds.Tables[0].Rows[0]["IDType"].ToString() != "")
 	                {
 	                    model.IDType = int.Parse(ds.Tables[0].Rows[0]["IDType"].ToString());
 	                }
 	                model.IDNumber = ds.Tables[0].Rows[0]["IDNumber"].ToString();
 	                model.IDAddress = ds.Tables[0].Rows[0]["IDAddress"].ToString();
 	                model.Email = ds.Tables[0].Rows[0]["Email"].ToString();
 	                model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
 	                if (ds.Tables[0].Rows[0]["EntryDate"].ToString() != "")
 	                {
 	                    model.EntryDate = DateTime.Parse(ds.Tables[0].Rows[0]["EntryDate"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["LeaveDate"].ToString() != "")
 	                {
 	                    model.LeaveDate = DateTime.Parse(ds.Tables[0].Rows[0]["LeaveDate"].ToString());
 	                }
 	                model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString();
 	                if (ds.Tables[0].Rows[0]["AreaId"].ToString() != "")
 	                {
 	                    model.AreaId = int.Parse(ds.Tables[0].Rows[0]["AreaId"].ToString());
 	                }
 	                model.Professional = ds.Tables[0].Rows[0]["Professional"].ToString();
                    model.State = ds.Tables[0].Rows[0]["State"].ToString();
 	                model.Nation = ds.Tables[0].Rows[0]["Nation"].ToString();
 	                model.Birthplace = ds.Tables[0].Rows[0]["Birthplace"].ToString();
 	                model.Marriage = ds.Tables[0].Rows[0]["Marriage"].ToString();
 	                if (ds.Tables[0].Rows[0]["Height"].ToString() != "")
 	                {
 	                    model.Height = decimal.Parse(ds.Tables[0].Rows[0]["Height"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["Education"].ToString() != "")
 	                {
 	                    model.Education = int.Parse(ds.Tables[0].Rows[0]["Education"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["LangScore"].ToString() != "")
 	                {
 	                    model.LangScore = int.Parse(ds.Tables[0].Rows[0]["LangScore"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["Language"].ToString() != "")
 	                {
 	                    model.Language = int.Parse(ds.Tables[0].Rows[0]["Language"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["Computer"].ToString() != "")
 	                {
 	                    model.Computer = int.Parse(ds.Tables[0].Rows[0]["Computer"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["WorkYear"].ToString() != "")
 	                {
 	                    model.WorkYear = int.Parse(ds.Tables[0].Rows[0]["WorkYear"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["ManagerYear"].ToString() != "")
 	                {
 	                    model.ManagerYear = int.Parse(ds.Tables[0].Rows[0]["ManagerYear"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["HavAbroad"].ToString() != "")
 	                {
 	                    if ((ds.Tables[0].Rows[0]["HavAbroad"].ToString() == "1") ||
 	                        (ds.Tables[0].Rows[0]["HavAbroad"].ToString().ToLower() == "true"))
 	                    {
 	                        model.HavAbroad = true;
 	                    }
 	                    else
 	                    {
 	                        model.HavAbroad = false;
 	                    }
 	                }
 	                if (ds.Tables[0].Rows[0]["HavCarSale"].ToString() != "")
 	                {
 	                    if ((ds.Tables[0].Rows[0]["HavCarSale"].ToString() == "1") ||
 	                        (ds.Tables[0].Rows[0]["HavCarSale"].ToString().ToLower() == "true"))
 	                    {
 	                        model.HavCarSale = true;
 	                    }
 	                    else
 	                    {
 	                        model.HavCarSale = false;
 	                    }
 	                }
 	                model.CarBrand = ds.Tables[0].Rows[0]["CarBrand"].ToString();
 	                if (ds.Tables[0].Rows[0]["CarYear"].ToString() != "")
 	                {
 	                    model.CarYear = int.Parse(ds.Tables[0].Rows[0]["CarYear"].ToString());
 	                }
 	                if (ds.Tables[0].Rows[0]["HavCarManager"].ToString() != "")
 	                {
 	                    if ((ds.Tables[0].Rows[0]["HavCarManager"].ToString() == "1") ||
 	                        (ds.Tables[0].Rows[0]["HavCarManager"].ToString().ToLower() == "true"))
 	                    {
 	                        model.HavCarManager = true;
 	                    }
 	                    else
 	                    {
 	                        model.HavCarManager = false;
 	                    }
 	                }
 	                model.Relations = ds.Tables[0].Rows[0]["Relations"].ToString();
 	                model.Skills = ds.Tables[0].Rows[0]["Skills"].ToString();
 	                model.CardNumber = ds.Tables[0].Rows[0]["CardNumber"].ToString();
 	                model.Notes = ds.Tables[0].Rows[0]["Notes"].ToString();
 	                model.Achievement = ds.Tables[0].Rows[0]["Achievement"].ToString();
 	                if (ds.Tables[0].Rows[0]["RefreshTime"].ToString() != "")
 	                {
 	                    model.RefreshTime = DateTime.Parse(ds.Tables[0].Rows[0]["RefreshTime"].ToString());
 	                }


 	                #endregion

 	                LRSCache.GetCacheService().AddObject(CacheKey, model, 2*60*60);
 	                return model;
 	            }
 	            else
 	            {
 	                return null;
 	            }

 	        }
 	        return (ART.Model.M_UsersDetail) objModel;
 	    }

 	    /// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return GetList(0,strWhere,"");
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return GetList(0,"*",strWhere,filedOrder);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string FieldName,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" "+FieldName+" FROM UsersDetail ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			if(filedOrder.Trim()!="")
			{
				strSql.Append(" order by " + filedOrder);
			}
			return SqlHelper.ExecDataSet(strSql.ToString());
		}
#endregion

      #region __________自定义方法__________
        public bool isExitUser(int uid)
        {
            string cmdtext = "select count(*) from UsersDetail where uid=" + uid;
            object obj = SqlHelper.ExecScalar(cmdtext, new SqlParameter[0]);
            if (obj != null)
            {
                return Utils.StrToInt(obj, 0) > 0;
            }
            return false;
        }
      #endregion 
	}
}

